<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li></li>
    </ul>
    <script>

        //克隆节点
        const create = document.createElement('div');
        create.innerHTML = '创建的div';
        document.body.appendChild(create);
        const p = document.createElement('p');
        p.innerHTML = 'div的后代';
        create.appendChild(p);
        //元素.cloneNode(布尔值) 克隆节点
        //false 克隆包含后代节点 默认false
        //true 不包含后代节点
        const clo = create.cloneNode(true);
        // clo.innerHTML = '克隆的节点';s
        document.body.appendChild(clo);
        //---------
        const uls = document.querySelector('ul');
        const clo1 = uls.children[0].cloneNode(true);
        uls.appendChild(clo1);
    </script>
</body>

</html>